package com.ima.web.ajax.controllers;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ima.web.beans.db.SubCategories;
import com.ima.web.beans.form.SubCategoriesForm;
import com.ima.web.service.SubCategoriesService;

@Controller
@RequestMapping("/ajax/subcategories")
public class SubCatAjaxController {

	private SubCategoriesService subCatService;
	
	@Autowired
	public void setDependencies(SubCategoriesService subCatService){
		this.subCatService = subCatService;
	}
	
	@RequestMapping("/list/cat/{catId}")
	public @ResponseBody List<SubCategoriesForm> getSubCatByCatId(@PathVariable Integer catId){
		return subCatService.getListForFormForCat(catId);
	}
}
